using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class SkyboxGodRayFeature : ScriptableRendererFeature
{
    [System.Serializable]
    public class Settings
    {
        public RenderPassEvent renderPassEvent = RenderPassEvent.AfterRenderingTransparents;
        public string passName = "GodRay";
        public PrimitiveType primitiveType = PrimitiveType.Cube;
   
        public bool enable = true;
    }

    [SerializeField] Settings settings = new Settings();
    SkyboxGodRayPass godRayPass;

    public override void Create()
    {
        if (!settings.enable)
        {
 
            return;
        }

        godRayPass = new SkyboxGodRayPass(
            settings.renderPassEvent,
            settings.passName,
            settings.primitiveType 
        );
    }

    public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
    {
        if (!settings.enable || godRayPass == null)
        {
 
            return;
        }
 
        renderer.EnqueuePass(godRayPass);
    }
}